//
//  CenterMultiSelectionCell.m
//  18Birdies
//
//  Created by poleness on 2017/3/2.
//  Copyright © 2017年 Lc. All rights reserved.
//

#import "CenterMultiSelectionCell.h"

@implementation CenterMultiSelectionCell

- (void)awakeFromNib {
  [super awakeFromNib];

  [self.checkerButton setImage:[UIImage imageNamed:@"choice_normal"] forState:UIControlStateNormal];
  [self.checkerButton setImage:[UIImage imageNamed:@"choice_active"]
                      forState:UIControlStateSelected];
  [self.checkerButton setImage:[UIImage imageNamed:@"choice_active"]
                      forState:UIControlStateHighlighted];

  [self.titleLabel addGestureRecognizer:[[UITapGestureRecognizer alloc]
                                            initWithTarget:self
                                                    action:@selector(titleLabelClicked)]];
}

- (IBAction)checkerButtonClicked:(UIButton*)sender {
  self.checkerButton.selected = !self.checkerButton.selected;
  if (self.checkerClickedHandler != nil) {
    self.checkerClickedHandler(sender);
  }
}

- (void)titleLabelClicked {
  [self checkerButtonClicked:nil];
}

@end
